

<h2><?php echo $sitemap['breadcrumb']?></h2>
<div class="hl-post">
	<div class="hl-left product-left">
    	<?php if(in_array("sanphamhot",$properties)){ ?>
        <div id="hl-icon-hot-detail" class="hl-icon">
            <img src="<?php echo HTTP_SERVER.DIR_IMAGE?>icon/ico-hot.png" />
        </div>
        <?php } ?>
        <?php if(in_array("sanphamkhuyenmai",$properties)){ ?>
        <div id="hl-icon-sale-detail" class="hl-icon">
            <img src="<?php echo HTTP_SERVER.DIR_IMAGE?>icon/ico-sale.png" />
        </div>
        <?php } ?>
        <?php if(in_array("sanphammoi",$properties)){ ?>
        <div id="hl-icon-new-detail" class="hl-icon">
            <img src="<?php echo HTTP_SERVER.DIR_IMAGE?>icon/ico-new.png" />
        </div>
        <?php } ?>
        <?php if($media['imagethumbnail'] !=""){ ?>
        <a class="islink" href="<?php echo $media['link']?>"><img src='<?php echo $media['imagethumbnail']?>' class='hl-center' /></a>
        <?php }?>
    	<?php if($post['imagethumbnail'] !=""){ ?>
        <div class="product-mainimage">
        	<table>
            	<tr valign="middle">
                	<td id="product-preview"><a class="zoom" href="<?php echo $post['imagepreview']?>"><img  src="<?php echo $post['imagethumbnail']?>" /></a></td>
                </tr>
            </table>
	        
        </div>
        
        <?php }?>
        
        <div id="hl-galary" class="hl-center">
            <table>
                <tr>
                    <td style="width:14px">
                        <img class="hl-link" id="hl-prev" src="<?php echo HTTP_SERVER.DIR_IMAGE?>galary_button_prev.png" />
                    </td>
                    <td>
                        <div style="overflow:hidden;width:248px;margin:0 auto;">
                            <table id="hl-scroll">
                                <tr>
                                   
                                    <?php foreach($subimage as $key => $val){ ?>
                                    <td>
                                        <img  id="icon-<?php echo $key?>" class="hl-icon-item" src="<?php echo $val['icon']?>" />
                                    </td>
                                    <?php } ?>
                                </tr>
                            </table>
                        </div>
                        
                    </td>
                    <td style="width:14px">
                        <img class="hl-link" id="hl-next" src="<?php echo HTTP_SERVER.DIR_IMAGE?>galary_button_next.png" />
                    </td>
                </tr>
            </table>
        </div>
<script language="javascript">
$(document).ready(function() { 
$(".hl-icon-item").click(function(){
	var arr = this.id.split("-");
	var key = arr[1];
	$("#product-preview").html($("#preview-"+key).html());
	$(".zoom").fancybox({
			'overlayShow'	: true,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic'
		});
});

	
	$('#hl-container').tabs({ fxSlide: true, fxFade: true, fxSpeed: 'slow' });
	
	$(".zoom").fancybox({
			'overlayShow'	: true,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic'
		});
});
</script>
<script language="javascript">
var block1 = 62;
var length = $("#hl-scroll").width();
var view = 248;
var move = true
var movenext = true
$("#hl-prev").click(function(){
	movenext = true;
	if(move == true)
	{
		move = false;
		var left = $("#hl-scroll").css("margin-left").replace("px","");
		//alert(left);
		if(left < 0)
		{
			
			$("#hl-scroll").animate({"marginLeft": "+="+ block1 +"px"}, "slow",function(){
				/*left = $("#hl-scoll").css("margin-left").replace("px","");
				if(left > 0)
					$("#hl-scoll").css("margin-left","0px");*/
				move = true;
			});
			
			
		}
		else
			move = true;
	}
		
});
$("#hl-next").click(function(){
	length = $("#hl-scroll").width();
	if(movenext == true)
	{
		movenext = false;
		
		var left = $("#hl-scroll").css("margin-left").replace("px","");
		
		if( parseInt(length) + parseInt(left) > view)
			$("#hl-scroll").animate({"marginLeft": "-="+ block1 +"px"}, "slow",function(){
				movenext = true;
			});
	}
	
});
</script>
        <div style="display:none">
            <?php foreach($subimage as $key => $val){ ?>
            <div  id="preview-<?php echo $key?>">
                <a class="zoom" href="<?php echo $val['imagepreview']?>"><img src="<?php echo $val['imagethumbnail']?>" /></a>
            </div>
            <?php } ?>
        </div>
     
    </div>
    <div class="hl-right product-right">
        <h2><?php echo $post['title']?></h2>
        <a href="http://www.facebook.com/sharer/sharer.php?u=<?php echo $post['link']?>" target="_blank">
    		<img src="<?php echo HTTP_SERVER.DIR_IMAGE?>facebook.gif" />
    	</a>
        <a href="https://twitter.com/intent/tweet?source=webclient&text=<?php echo $this->document->title?>-<?php echo $post['link']?>" target="_blank">
    		<img src="<?php echo HTTP_SERVER.DIR_IMAGE?>twitter.gif" />
    	</a>
        <div class="hl-post-body">
        	<p>
            	<table>
                	
                    <tr>
                    	<td><strong>Nhản hiệu:</strong></td>
                        <td>
                        	
                            <a href="<?php echo $this->document->createLink('brandinfor',$post['brand'])?>"><?php echo $this->document->getCategory($post['brand'])?></a>
                            
                        </td>
                    </tr>
                    
                    <tr>
                    	<td><strong>Màu sắc</strong></td>
                        <td>
                        	<?php foreach($color as $co){ ?>
                        		<?php if(in_array($co['categoryid'],$properties)){ ?>
                            		<?php echo $co['categoryname']?><br />
                                <?php } ?>
                            <?php } ?>
                        </td>
                    </tr>
                    <tr>
                    	<td><strong>Kích cỡ</strong></td>
                        <td>
                        	<?php foreach($size as $si){ ?>
                        		<?php if(in_array($si['categoryid'],$properties)){ ?>
                            		<?php echo $si['categoryname']?><br />
                                <?php } ?>
                            <?php } ?>
                        </td>
                    </tr>
                </table>
            	
                
            </p>
            <p>
            	<?php echo $post['summary']?>
                
            </p>
            <p>
            	Giá:
                <?php $cls = '';?>
                <?php if($post['pricepromotion']){ ?>
                <?php $cls = 'product-price-no';?>
                <span class="product-pricepromotion">
                <?php echo $this->string->numberFormate($post['pricepromotion'])?> <?php echo $this->document->setup['Currency']?>
                </span>
                <?php } ?>
                    
                <span  class="product-price <?php echo $cls?>"><?php echo $this->string->numberFormate($post['price'])?> <?php echo $this->document->setup['Currency']?></span>
            	 
                
            </p>
            <a onclick="cart.add('<?php echo $post['mediaid']?>')"><img src="<?php echo HTTP_SERVER.DIR_IMAGE?>btn-add-cart.png" /></a>
        </div>
        
    </div>
    <div class="clearer">&nbsp;</div>

    <div class="hl-hline"></div>
    <p>
        <?php echo $post['description']?>
    </p>
    
    <p class="hl-text-right">
        <b><?php echo $post['source']?></b>
    </p>
    
    
    
    <?php if(count($child)){ ?>
    <div id="subinfo">
                
                
        <ul>
            <?php foreach($child as $key => $item){ ?>
                <li><a href="#fragment-<?php echo $key?>"><span><?php echo $item['title']?></span></a></li>	
            <?php } ?>
        </ul>
       
        <?php foreach($child as $key => $item){ ?>
        <div id="fragment-<?php echo $key?>">
            <?php echo html_entity_decode($item['description'])?>
        </div>
        <?php } ?>
                
    </div>
    <?php } ?>
    
    
    
    
    <div class="clearer">&nbsp;</div>
</div>

	
<h2>Sản phẩm cùng nhãn hiệu</h2>

<?php echo $saphamcungnhanhieu?>


<script language="javascript">
$(".product-icon").click(function(){
	var arr = this.id.split("-");
	var key = arr[1];
	$("#product-preview").attr("src",$("#preview-"+key).attr("src"));
});


$(document).ready(function() { 
	$('#subinfo').tabs({ fxSlide: true, fxFade: true, fxSpeed: 'slow' });
	$.get(HTTP_SERVER+"?route=addon/product/addViewlist&mediaid=<?php echo $post['mediaid']?>");
});
function xemkhuyenmai(makhuyenmai)
{
		$("#hl-popup").attr('title','Thông tin khuyến mãi');
				$( "#hl-popup" ).dialog({
					autoOpen: false,
					show: "blind",
					hide: "explode",
					width: 550,
					height: 350,
					modal: true,
					close: function(event, ui)
						{ 
							
						},
					buttons: {
						
						
						"Đóng": function() {
							$( this ).dialog( "close" );
							
						}
					}
				});
		$('#hl-popup-content').load(HTTP_SERVER+'?route=addon/media&id='+makhuyenmai,function(){
			$("#hl-popup").dialog("open");	
		});
				
}

function sendComment()
{
	$.blockUI({ message: "<h1>Please wait...</h1>" }); 
	
	$.post("<?php echo HTTP_SERVER?>?route=module/comment/sendComment", $("#frmComment").serialize(),
		function(data){
			if(data == "true")
			{
				$('#comment-warning').html("Bạn đã gui nhận xét thành công. Chúng tôi sẻ kiểm duyệt nội dung của bạn trước khi hiện lên website").show('slow');
				$('#frmComment').hide();
			}
			else
			{
				
				$('#comment-warning').html(data).show('slow');
				
				
			}
			$.unblockUI();
		}
	);		
}
</script>